package com.tth.learn.addproperties.java1;

import org.junit.Test;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.function.Function;

/**
 * @Author tth
 * @Date 2023/1/3 15:22
 */
public class ArrayReferenceTest {

    /**
     *
     */
    @Test
    public void test() {
        Function<Integer, String[]> fun1 = length -> new String[length];
        String[] arr1 = fun1.apply(5);
        System.out.println(Arrays.toString(arr1));

        System.out.println("************************************************");

        Function<Integer, String[]> fun2 = String[] :: new;

        String[] arr2 = fun2.apply(10);
        System.out.println(Arrays.toString(arr2));
    }
}
